/**
 * @author Jjn
 * @since 2021-06-12 13:14
 */
public class Solution5_2 {
    public String reverseLeftWords(String s, int n) {
        if (s == null) {
            return null;
        }
        int length = s.length();
        n = n % length;
        StringBuilder stringBuilder = new StringBuilder();
        for (int i = n; i < length; i++) {
            stringBuilder.append(s.charAt(i));
        }
        for (int i = 0; i < n; i++) {
            stringBuilder.append(s.charAt(i));
        }
        return stringBuilder.toString();
    }
    
    public static void main(String[] args) {
        Solution5_2 solution52 = new Solution5_2();
        System.out.println(solution52.reverseLeftWords("abcdefg", 3));
    }
}
